package com.hnevc.xiaoming.fragment;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.hnevc.xiaoming.R;
import com.hnevc.xiaoming.activity.MyShoping;
import com.hnevc.xiaoming.adapter.MySpAdapter;
import com.hnevc.xiaoming.bean.SpBean;

import java.util.ArrayList;
import java.util.List;

public class Fragment2 extends Fragment {

    private View view;
    private ListView listView;
    private List<SpBean> spBeans;
    private MySpAdapter mySpAdapter;


    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment2_layout, container, false);
        initView();
        initData();
        initEvent();
        return view;
    }

    private void initEvent() {


    }

    private void initData() {


    }


    private void initView() {
        listView = view.findViewById(R.id.listView);
        spBeans = new ArrayList<>();
        spBeans.add(new SpBean(1,"蚂蚁上树","蚂蚁上树蚂蚁上树蚂蚁上树","one"));
        spBeans.add(new SpBean(2,"红烧肉","红烧肉红烧肉红烧肉","tow"));
        spBeans.add(new SpBean(3,"月饼","月饼月饼月饼","fore"));
        spBeans.add(new SpBean(4,"青椒肉丝","青椒肉丝青椒肉丝青椒肉丝","tree"));
        spBeans.add(new SpBean(1,"蚂蚁上树","蚂蚁上树蚂蚁上树蚂蚁上树","one"));
        spBeans.add(new SpBean(5,"红烧肉","红烧肉红烧肉红烧肉","tow"));
        spBeans.add(new SpBean(6,"月饼","月饼月饼月饼","fore"));
        spBeans.add(new SpBean(7,"青椒肉丝","青椒肉丝青椒肉丝青椒肉丝","tree"));
        mySpAdapter = new MySpAdapter(spBeans, getContext());
        listView.setAdapter(mySpAdapter);
    }

}
